#ifndef _TORUS_GAME_H_
#define _TORUS_GAME_H_

#include "object/block.h"
#include "object/vector.h"
#include "config.h"


class torus_game
{
public:
	static torus_game& get_instance();

	void update(float delta_time);
	void render();
	void debug_print();
	bool is_game_end() { return game_end; };
	void clean_up();

private:
	torus_game();
	torus_game(torus_game const&);
	void operator=(torus_game const&);
	~torus_game();

	void reset();
	bool is_block_movable(block& b, int mx, int my);
	bool is_block_rotable(block& b);
	bool is_block_placable(block& b);
	void generate_block();
	bool remove_full_line();
	void update_matrix();

	block*		matrix[GROUND_MAX_X][GROUND_MAX_Y];
	block*		active_block;
	block_list	b_list;
	int			score;
	bool		game_end;
};

#define GAME torus_game::get_instance()

#endif